const express=require("express")
const router=express.Router()
const addAriticle=require("../service/addArticle")
router.post("/addArticle",(req,res)=>{
    let params=req.body
    let title=params.title 
    let content=params.content 
    let des=params.des 
    let author=params.author 
    let authorId=(parseInt)(params.authorId)  
    let classify=params.classify 
    let time=params.time
    addAriticle(title,content,des,author,authorId,classify,time).then(data=>{
        if(data==404){
            res.json({
                status: data,
                msg: "添加失败"
            })
        }else{
            res.json({
                status: 200,
                msg: data
            })
        }
    })
})
module.exports=router